cmake_minimum_required(VERSION 3.24)

project(util VERSION 0.1.0  LANGUAGES C CXX)

set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
# Some necessary settings
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# add_compile_definitions(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
# add_compile_options(-g -O0 -fno-inline-functions)
# 查找Boost
find_package(Boost COMPONENTS context system thread serialization REQUIRED) # Asio作为Boost的一部分，通常需要system和thread组件


if(BUILD_TEST)
    add_definitions(-DBUILD_TEST)
endif()

# 递归查找当前目录及子目录下的所有 .cpp 文件
file(GLOB_RECURSE UTILS_SOURCES "./src/*.cc")

# 添加执行目标
add_library(${PROJECT_NAME} STATIC ${UTILS_SOURCES})

include_directories(${PROJECT_NAME} PUBLIC
    ./include 
)
message(STATUS "########## test message #########")
# 链接Boost.Asio
target_link_libraries(${PROJECT_NAME} PUBLIC
    asio
    fmt
)
